package com.Ace.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.security.auth.message.callback.PrivateKeyCallback.Request;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import Models.JdbcUtils;
import Models.Student;


@Controller
public class Hello {
	//hello world
	@RequestMapping(value="/hello")
	public String hello(){
		System.out.print("Spring mvc hello world!");
		return "hello";
	}
//hello world
	@RequestMapping(value="/ok")
@ResponseBody
 public Object ok(){
		System.out.println("ok");
		List<String> list=new ArrayList<String>();
		list.add("Yorry");
		list.add("Wendy");
		list.add("kiki");
		list.add("tina");
		list.add("levon");
		list.add("Mark");
		list.add("Lex");

		return list.toString();
	}
	@RequestMapping(value="/login")
	public String login(String name,String password){
		Student student = null;
		student.setName(name);
		student.setPassword(password);
		
		if (student.getName().equals("admin")&&student.getPassword().equals("12345")) {
			return "success";
		}
		
		return "login";
	}
}
